<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" inline>
      <el-form-item label="所属公司">
        <TenantChoose @loaded="search" v-model="form.tenant_id" />
      </el-form-item>
      <br />
      <el-form-item label="所属站点">
        <SiteRadioAll v-model="form.site_id" @change="search" />
      </el-form-item>
      <br />
      <el-form-item label="还款类型">
        <el-radio-group v-model="form.repay_type" @change="search">
          <el-radio-button :label="0">所有</el-radio-button>
          <el-radio-button :label="1">余额</el-radio-button>
          <el-radio-button :label="3">微信</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="姓名">
        <el-input v-model="form.realname" clearable style="width: 180px" />
      </el-form-item>
      <el-form-item label="电话">
        <el-input v-model="form.tel" clearable style="width: 180px" />
      </el-form-item>
      <br />
      <el-form-item label="还款日期">
        <el-date-picker
          v-model="form.startDate"
          type="date"
          value-format="YYYY-MM-DD"
          style="width: 180px"
          placeholder="开始"
        />
      </el-form-item>
      <el-form-item label="还款日期">
        <el-date-picker
          v-model="form.endDate"
          type="date"
          value-format="YYYY-MM-DD"
          style="width: 180px"
          placeholder="结束"
        />
      </el-form-item>

      <el-form-item label-width="16px">
        <el-button type="primary" @click="search">查询</el-button>
      </el-form-item>
    </el-form>
  </ele-card>
</template>

<script setup>
  import { useFormData } from '@/utils/use-form-data';
  const emit = defineEmits(['search']);

  /** 表单数据 */
  const [form] = useFormData({
    site_id: 0,
    tel: '',
    realname: '',
    repay_type: 0,
    endDate: '',
    startDate: ''
  });

  /** 搜索 */
  const search = () => {
    console.log(form);
    emit('search', { ...form });
  };
</script>
